//服务器全部接口返回的数据类型
export interface ResponseData {
    code: number,
    message: string,
    ok: boolean
}
//spu数据ts类型
export interface SpuData {
    id?: number,
    spuName: string,
    description: string,
    category3Id: string | number,
    tmId: number  //品牌ID
    spuSaleAttrList: null | SaleAttr[],
    spuImageList: null | SpuImg[],
}
//data:元素都是已有的sp数据类型
export type Records = SpuData[]

//定义获取已有spu接口返回的数据类型
export interface HasSpuResponseData extends ResponseData {
    data: {
        records: Records, //data
        total: number,   //一共有多少个spu
        size: number, //当前页码有几个
        current: number,//当前页码
        searchCount: boolean,
        pages: number, //有几页
    }
}

//品牌

//已有品牌ts数据类型
export interface TradeMark {
    id?: number,
    tmName: string,
    logoUrl: string,
}

//品牌接口返回的数据类型
export interface AllTradeMark extends ResponseData {
    data: TradeMark[]
}

// 照片
export interface SpuImg {
    id?: number,    //照片本身的id
    createTime?: string,
    updateTime?: string,
    spuId?: number,  //所属品牌(spu)id
    imgName?: string,
    imgUrl?: string,
    name?: string  // 添加 el-upload 需要的属性
    url?: string   // 添加 el-upload 需要的属性
}


export interface SpuHasImg extends ResponseData {
    data: SpuImg[]
}

//销售属性
//销售属性值
export interface SaleAttrValue {
    id?: number,
    createTime?: null,
    updateTime?: null,
    spuId?: number,
    baseSaleAttrId: number | string,
    saleAttrValueName: string,  //销售属性值的名字
    saleAttrName?: string, //哪个销售属性
    isChecked?: null
}

export type SpuSaleAttrValueList = SaleAttrValue[]
//data
export interface SaleAttr {
    id?: number,
    createTime?: null,
    updateTime?: null,
    spuId?: number,
    baseSaleAttrId: number | string,
    saleAttrName: string,
    spuSaleAttrValueList: SpuSaleAttrValueList,
    flag?: boolean, //编辑模式按钮
    saleAttrValue?: string, //编辑模式-属性值
}

export interface SaleAttrResponseData extends ResponseData {
    data: SaleAttr[]
}

//已有整个项目的属性
export interface HasSaleAttr {
    id: number,
    name: string
}

export interface HasSaleAttrResponseData extends ResponseData {
    data: HasSaleAttr[]
}

//sku Ts类型
export interface Attr {//平台属性
    attrId: number | string, //平台属性Id
    valueId: number | string,//平台属性值
}

export interface saleAttr{ //销售属性
    saleAttrId: number | string, //销售属性Id
    saleAttrValueId: number | string, //销售属性值
}
export interface SkuData {
    category3Id: string | number,
    spuId: string | number,
    tmId: string | number, //品牌ID
    skuName: string,
    price: string | number,
    weight: string | number, //重量
    skuDesc: string,  //sku描述
    skuAttrValueList:  Attr[]//平台属性
    skuSaleAttrValueList: saleAttr[]
    skuDefaultImg: string  // sku图片地址
}

//获取SKU数据接口返回数据的ts类型
export interface SkuInfoData extends ResponseData{
    data:SkuData[]
}











